% Copyright (C) 2009,2010,2011,2012  Marco Restelli
%
% This file is part of:
%   LDGH -- Local Hybridizable Discontinuous Galerkin toolkit
%
% LDGH is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LDGH is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
% License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LDGH. If not, see <http://www.gnu.org/licenses/>.
%
% author: Marco Restelli                   <marco.restelli@gmail.com>


function PV_cgdd (msh, U, outfile)

  %% PV_cgdd (msh, U, outfile)
  %%
  %% Write the solution U of the cg-dd model in a format readable by
  %% paraview (.vtu).


  %% make sure required packages are loaded
  pkg load fpl

  %% arrange data in a vtu file and save
  if exist ([outfile ".vtu"], "file")
    delete ([outfile ".vtu"]);
  endif

  fpl_vtk_write_field (outfile, msh, {U(:, 1), "n"; ...
				      U(:, 2), "p"; ...
				      U(:, 3), "V";
				      U(:, 4), "N_d";
				      U(:, 5), "N_a"}, 
		       {}, 1);

endfunction
